//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop
#pragma package(smart_init)

//---------------------------------------------------------------------------
#include "CVersion.h"
//---------------------------------------------------------------------------
//                      CONSTRUCTEUR
//---------------------------------------------------------------------------
__fastcall CVersion::CVersion(  TStrings * cbVersion,
                                const int &nLogiciel)
{
    try {
        m_cbVersion = cbVersion;
        m_nLogiciel = nLogiciel;
    }catch( Exception &e ) {
        EIC_DISPLAY_EXCEPTION(e);}
}
//---------------------------------------------------------------------------
//                      AJOUTER LISTE
//---------------------------------------------------------------------------
void __fastcall CVersion::AjouterListe()
{
    TdmWebHelp * dmWebHelp = NULL;
    TZZMySqlQuery * MaRequete = NULL;
    try {
        dmWebHelp = new TdmWebHelp((TComponent*)0);
        m_cbVersion->Clear();
        m_cbVersion->Add( "<Toutes>" );

        MaRequete = new TZZMySqlQuery( (TComponent*)0);
        MaRequete->Database = dmWebHelp->dbWebHelp;

        MaRequete->Sql->Text =  (AnsiString)"select ver_nom, ver_code "+
                                            "from versions "+
                                            "where log_code = "+m_nLogiciel+" order by ver_nom";
        MaRequete->Open();
        MaRequete->First();
        while(!MaRequete->Eof) {
            m_cbVersion->AddObject(  asRequete(0),(TObject*) nRequete(1) );
            MaRequete->Next();
        }
        MaRequete->Sql->Clear();
        MaRequete->Close();

    }catch( Exception &e ) {
        EIC_DISPLAY_EXCEPTION(e);}
    if(MaRequete) {delete MaRequete; MaRequete = NULL;}
    if(dmWebHelp) {delete dmWebHelp; dmWebHelp = NULL;}
}
//---------------------------------------------------------------------------
//                  PARAMETRER VERSION
//---------------------------------------------------------------------------
void __fastcall CVersion::Parametrer( void )
{
    TvAVersion * fParam = NULL;
    try {
        fParam = new TvAVersion((TComponent*)0);
        fParam->ShowModal();
        AjouterListe();
    }catch( Exception &e ) {
        EIC_DISPLAY_EXCEPTION(e);}
    if(fParam) {delete fParam; fParam = NULL;}
}
//---------------------------------------------------------------------------
